
var basicData = {
    /**
     * @Description: 构建目录树下拉框
     * @param:  * @usePathVal 是否将path当select value值
     * @Author: dustin
     * @Date: 2019-03-16 21:49
     */
    getCateTree: function (select, selectedId, usePathVal) {
        $lv.actionJson('/admin/videoCate/list', function (r) {
            $(select).append(treefor(0,r));
        });
        function treefor(id,obj){
            var a = '';
            for(var i=0,j;j=obj[i++];) {
                if (j.parentId == id) {
                    var level = j.parentIds.split('/').length;

                    a += '<option value="' + (usePathVal ? j.parentIds + '/'+j.id : j.id) + '" path="' + j.parentIds + '" ' + (j.id == selectedId ? 'selected="selected"' : '') + ' text="' + j.name + '">' + new Array(level).join('┆┄') + j.name + '</option>' + treefor(j.id, obj);
                }
            }
            return a;
        }
    },
    /**
     * @Description: 目录树下拉框选择事件
     * @param:  * @param null
     * @Author: dustin
     * @Date: 2019-04-07 8:09
     */
    selCateChange: function (sel) {
        var opt = $(sel).find("option:selected");
        $("#cateName").val(opt.attr("text"));
        $("#catePath").val(opt.attr("path")+ '/' + opt.val());
    }
};